package com.yinhai.asynctask;

import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.yinhai.constant.Contact;

import android.content.Context;

public class LoginCountTask  extends AsyncTaskForHttp{
	String retStr = null;
	public LoginCountTask(Context context) {
		super(context);
	}
	
	public LoginCountTask(Context context, boolean autoForword) {
		super(context, autoForword);
	}

	public LoginCountTask(Context context, int timeoutRequestCount,
			boolean autoForword) {
		super(context, timeoutRequestCount, autoForword);
	}
	@Override
	protected void parse(Map<String, Object> result) {
		this.retStr = (String)result.get(AsyncTaskContext.RESPONSE_CONTENT);
		JSONObject jsonObject;
		try {
			jsonObject = new JSONObject(retStr);
			JSONArray ja = (JSONArray)((JSONObject)jsonObject.get("obj")).get("data");
			if(ja != null && ja.length() > 0) {
				Contact.USER_ID=((JSONObject)ja.get(0)).get("recid")==null?"":((JSONObject)ja.get(0)).get("recid").toString();
			}
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
